<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <!-- TODO 切换登录方式时已经填好的内容不会重置 这是Vue中 Virtual DOM影响 -->
    <!-- 解决办法是给input标签加不同的key -->
    <span v-if="isShow">
      <label for="username">用户名</label>
      <input type="text" id="username" placeholder="请输入用户名">
    </span>
    <span v-else>
      <label for='email'>邮箱</label>
      <input type="text" id="email" placeholder="请输入正确邮箱账号">
    </span>
    <button @click="changeTag">切换登录方式</button>
  </div>
  <script src="../../vue.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: { isShow: true },
      methods: {
        changeTag() {
          this.isShow = !this.isShow
        }
      }
    })
  </script>
</body>

</html>